package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 创建一个User类，提供sayHi方法
 * 使用Spring容器管理对象,获取实例并调用sayHi方法
 */
public class Test {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context =
                new AnnotationConfigApplicationContext("demo1");
        User user = (User) context.getBean(User.class);
        user.sayHi();
    }
}
